<%@ page contentType="text/html;charset=utf-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

		
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
        <%@ include file="../jslib/jquerylib.jsp" %>   
		<link rel="stylesheet" type="text/css" href="<%=request.getContextPath() %>/web/style/layout.css" />
		<script type='text/javascript' src="<%=request.getContextPath() %>/jslib/jquery.form.js"></script>
		<script type="text/javascript" src="<%=request.getContextPath()%>/jslib/My97DatePicker/WdatePicker.js"  defer="defer" ></script>
		<script type="text/javascript" src="<%=request.getContextPath() %>/jslib/lhgdialog/lhgcore.lhgdialog.min.js?skin=mac"></script>
	       <!-- 删除结果信息返回 -->
	    	<c:if test="${requestScope.message!=null}">
				<script type="text/javascript">
	  	 		     alert('<c:out value="${requestScope.message}"></c:out>');
	  	 		     window.close();
	  			</script>
	        </c:if>  
	     <style type="text/css">
			body, html{
			 overflow-x:hidden 
			}	
		</style>
		<script type="text/javascript">
			var api = frameElement.api, W = api.opener;
			var sbId = '${requestScope.equipmentid}';
			var common_contextPath="<%=common_contextPath%>";
			var common_basePath="<%=common_basePath%>";
			var common_width = window.screen.width-0;
			var common_height = window.screen.height-400;
			$(document).ready(function(){
				var options = {
		  	    url:'<%=request.getContextPath() %>/eqAction!saveYiqi.action',
		  	     beforeSubmit: function() {
		   		      return checking();
		    	 },
		  	    dataType:'json',
		  	    success: function(data) {
		  	      if(data.result=='success'){
					alert("添加成功");
					api.close();
					W.gridSearch();
					
		  	      }
		  	   }};
				$('#saveBtn').click(function(){
					    	$('#pageFrom').ajaxSubmit(options);
			 	            return false;
		    	 });
				$('#closeBtn').click(function(){
		    		api.close();
				});
			});
			

	 	function checking(){
	   		var flag = true;
	   		var yiqilx =  document.getElementById("yiqilx").value;
			var yiqimc = document.getElementById("yiqimc").value;
			var zhizaobh = document.getElementById("zhizaobh").value;
			var goumairq = document.getElementById("goumairq").value;
			var zherenr = document.getElementById("zherenr").value;
			var suoshubmid = document.getElementById("suoshubmid").value;
			var shiyongdw = document.getElementById("shiyongdw").value;
			var jiandingzq = document.getElementById("jiandingzq").value;
			var xiacidjrq = document.getElementById("xiacidjrq").value;
			var tixingts = document.getElementById("tixingts").value;
			var daoqizt = document.getElementById("daoqizt").value;
			var shiyongzt = document.getElementById("shiyongzt").value;
			if(yiqilx ==null || yiqilx == "" ){
				alert("仪器类型不能为空！");
				$("#yiqilx").focus();
	    		return false;
			}
			if(yiqimc ==null || yiqimc == "" ){
				alert("仪器名称不能为空！");
				$("#yiqimc").focus();
	    		return false;
			}
			if(zhizaobh ==null || zhizaobh == "" ){
				alert("制造编号不能为空！");
				$("#zhizaobh").focus();
	    		return false;
			}
			if(goumairq ==null || goumairq == "" ){
				alert("购买日期不能为空！");
				$("#goumairq").focus();
	    		return false;
			}
			if(zherenr ==null || zherenr == "" ){
				alert("责任人不能为空！");
				$("#zherenr").focus();
	    		return false;
			}
			if(suoshubmid ==null || suoshubmid == "" ){
				alert("所属部门不能为空！");
				$("#suoshubmid").focus();
	    		return false;
			}
			if(shiyongdw ==null || shiyongdw == "" ){
				alert("使用单位不能为空！");
				$("#shiyongdw").focus();
	    		return false;
			}
			if(jiandingzq ==null || jiandingzq == "" ){
				alert("检定周期不能为空！");
				$("#jiandingzq").focus();
	    		return false;
			}
			if(xiacidjrq ==null || xiacidjrq == "" ){
				alert("下次定检日期不能为空！");
				$("#xiacidjrq").focus();
	    		return false;
			}
			if(tixingts ==null || tixingts == "" ){
				alert("提醒天数不能为空！");
				$("#tixingts").focus();
	    		return false;
			}
			if(daoqizt ==null || daoqizt == "" ){
				alert("到期状态不能为空！");
				$("#daoqizt").focus();
	    		return false;
			}
			if(shiyongzt ==null || shiyongzt == "" ){
				alert("使用状态不能为空！");
				$("#shiyongzt").focus();
	    		return false;
			}
			return true;
		}	

    //导入
	function impExcel(){
			var type="eqAction!inportExcelEquMain.action";
			var sURL="file_importecxel.jsp?type="+type;
	   		window.showModalDialog(sURL,"","dialogWidth=400px;dialogHeight=200px;dialogLeft:400xp;dialogTop:100xp");
	    	location.reload();  
	}
   
    
    //选择部门
	function selectdept(id)
	{
		var datas = window.showModalDialog("<%=request.getContextPath() %>/resource/choose/choose_organizationIndex.jsp?temp="+Math.round(Math.random()*10000),'',"dialogWidth=900px;dialogHeight=550px");
		if(typeof(datas) == 'undefined'){
		}else{
			var json1 = eval('(' + datas + ')');
			 document.getElementById("suoshubmmc").value = json1.ORG_NAME;
			 document.getElementById(id).value = json1.ORG_ID;
		}
	}
		
		
    </script>
	</head>
<body style='background-color:#fff;'><!--=============== tree=====================================  -->
<div id="tabs" style="height:850px;"> 
	<form id="pageFrom" action="" enctype="multipart/form-data" method="post">
        <input type="hidden" id="flag" name="flag" />
  		<table width="1000" border="0" align="center" cellpadding="5" cellspacing="5" class="formTableNew">
  			<tr>
  			  <td align="right">仪器类型：</td>
  			  <td align="left">
  			    <input  type="text"  id="yiqilx" maxlength="50" name="equipment.yiqilx" style="border: 1px solid #999;padding: 5px;width: 245px;height:20px;"  value="" />
  			  	<img src="<%=request.getContextPath() %>/images/xh.png" align="absmiddle"></img>
  			  </td>
  			  <td align="right">仪器名称：</td>
  			  <td align="left">
  			    <input  type="text"  id="yiqimc" maxlength="50" name="equipment.yiqimc" style="border: 1px solid #999;padding: 5px;width: 245px;height:20px;"  value="" />
  			  	<img src="<%=request.getContextPath() %>/images/xh.png" align="absmiddle"></img>
  			  </td>
  			</tr>
  			<tr>
  			  <td align="right">规格型号：</td>
  			  <td align="left">
  			    <input  type="text"  id="guigexh" maxlength="50" name="equipment.guigexh" style="border: 1px solid #999;padding: 5px;width: 245px;height:20px;"  value="" />
  			  </td>
  			  <td align="right">制造厂商：</td>
  			  <td align="left">
  			    <input  type="text"  id="zhizaocs" maxlength="50" name="equipment.zhizaocs" style="border: 1px solid #999;padding: 5px;width: 245px;height:20px;"  value="" />
  			  </td>
  			</tr>
  			<tr>
  			  <td align="right">制造编号：</td>
  			  <td align="left">
  			    <input  type="text"  id="zhizaobh" maxlength="50" name="equipment.zhizaobh" style="border: 1px solid #999;padding: 5px;width: 245px;height:20px;"  value="" />
  			  	<img src="<%=request.getContextPath() %>/images/xh.png" align="absmiddle"></img>
  			  </td>
  			  <td align="right">精度等级：</td>
  			  <td align="left">
  			    <input  type="text"  id="jingdudj" maxlength="50" name="equipment.jingdudj" style="border: 1px solid #999;padding: 5px;width: 245px;height:20px;"  value="" />
  			  </td>
  			</tr>
  			<tr>
  			  <td align="right">测量范围：</td>
  			  <td align="left">
  			    <input  type="text"  id="celiangfw" maxlength="50" name="equipment.celiangfw" style="border: 1px solid #999;padding: 5px;width: 245px;height:20px;"  value="" />
  			  </td>
  			  <td align="right">购买日期：</td>
  			  <td align="left">
  			    <input class="Wdate"  type="text" id="goumairq"  name="equipment.goumairq" onClick="WdatePicker()" style="border: 1px solid #999;padding: 5px;width: 245px;height:20px;"  value="" />
  			    <img src="<%=request.getContextPath() %>/images/xh.png" align="absmiddle"></img>
  			  </td>
  			</tr>
  			<tr>
  			  <td align="right">责任人：</td>
  			  <td align="left">
  			    <input  type="text"  id="zherenr" maxlength="50" name="equipment.zherenr" style="border: 1px solid #999;padding: 5px;width: 245px;height:20px;"  value="" />
  			  	<img src="<%=request.getContextPath() %>/images/xh.png" align="absmiddle"></img>
  			  </td>
 			  <td align="right" >所属部门：</td>
  			  <td align="left" width="315">
  			    <input  type="text" readonly  id="suoshubmmc" maxlength="50" name="equipment.suoshubmmc" style="border: 1px solid #999;padding: 5px;width:245px;height:20px;"  value="${requestScope.org_name }" />
  			  	<input type="hidden" id="suoshubmid" name="equipment.suoshubmid" value="${requestScope.org_id }"/>
  			  	<img src="<%=request.getContextPath() %>/images/xh.png" align="absmiddle"></img>
  			  	<img src="<%=request.getContextPath() %>/web/images/form_icon_1.gif" style="cursor:hand; vertical-align: middle;" onclick="selectdept('suoshubmid')" />
  			  </td>
  			</tr>
  			<tr>
  			  <td align="right">使用单位：</td>
  			  <td align="left">
  			    <input  type="text"  id="shiyongdw" maxlength="50" name="equipment.shiyongdw" style="border: 1px solid #999;padding: 5px;width: 245px;height:20px;"  value="" />
  			  	<img src="<%=request.getContextPath() %>/images/xh.png" align="absmiddle"></img>
  			  </td>
  			  <td align="right">检定周期：</td>
  			  <td align="left">
  			    <input  type="text"  id="jiandingzq" maxlength="50" name="equipment.jiandingzq" 
  			    style="border: 1px solid #999;padding: 5px;width: 245px;height:20px;"  value="" onkeyup="javascript:RepNumber(this)"/>
  			  	<img src="<%=request.getContextPath() %>/images/xh.png" align="absmiddle"></img>
  			  </td>
  			</tr>
  			<tr>
  			  <td align="right">下次定检日期：</td>
  			  <td align="left">
  			    <input class="Wdate"  type="text"  id="xiacidjrq"  name="equipment.xiacidjrq" onClick="WdatePicker()" style="border: 1px solid #999;padding: 5px;width: 245px;height:20px;"  value="" />
  			  	<img src="<%=request.getContextPath() %>/images/xh.png" align="absmiddle"></img>
  			  </td>
  			  <td align="right">提醒天数：</td>
  			  <td align="left">
  			    <input  type="text"  id="tixingts" maxlength="50" name="equipment.tixingts" 
  			    style="border: 1px solid #999;padding: 5px;width: 245px;height:20px;"  value="" onkeyup="javascript:RepNumber(this)"/>
  			  	<img src="<%=request.getContextPath() %>/images/xh.png" align="absmiddle"></img>
  			  </td>
  			</tr>
  			<tr>
  			  <td align="right">到期状态：</td>
  			  <td align="left">
  			    <select id="daoqizt" class='fselect' name="equipment.daoqizt" class='easyui-validatebox' style="border: 1px solid #999;padding: 5px;width:258px;height:30px;" >
 			      <option value="未到期">未到期</option>
			 	  <option value="已到期">已到期</option>
 			    </select>
  			  	<img src="<%=request.getContextPath() %>/images/xh.png" align="absmiddle"></img>
  			  </td>
  			  <td align="right">使用状态：</td>
  			  <td align="left">
  			    <select id="shiyongzt" class='fselect' name="equipment.shiyongzt" class='easyui-validatebox' style="border: 1px solid #999;padding: 5px;width:258px;height:30px;" >
 			      <option value="维护">维护</option>
			 	  <option value="试验中">试验中</option>
			 	  <option value="送检">送检</option>
			 	  <option value="维修">维修</option>
			 	  <option value="借出">借出</option>
			 	  <option value="报废">报废</option>
 			    </select>
 			    <img src="<%=request.getContextPath() %>/images/xh.png" align="absmiddle"></img>
  			  </td>
  			</tr>
  			<tr>
  			  <td align="right">使用次数：</td>
  			  <td align="left">
  			    <input  type="text" id="shiyongcs" maxlength="50" name="equipment.shiyongcs" 
  			    style="border: 1px solid #999;padding: 5px;width: 245px;height:20px;"  value="0" onkeyup="javascript:RepNumber(this)"/>
  			  </td>
  			  <td align="right">&nbsp;</td>
  			  <td align="left">
  			    &nbsp;
  			  </td>
  			</tr>
		</table>
		<table width="100%" border="0" align="center" class="formTableNew">
		  <tr>
			<td align="center" >
		    	<input id="saveBtn" type="button" value="提 交" class="form_bt_orange" />
		    	<input type="button" id="closeBtn" value="取 消"  class="form_bt_grey" />
		    </td>
		  </tr>
		</table>
	<!--表单结束-->
	</form>
	</body>

</html>
